﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Configuration;


namespace Gmail.Model
{
    public class Credentials
    {
        public class CredentialsInformation
        {
            private String _Username;
            private String _Password;
            public CredentialsInformation(String Username, String Password)
            {
                _Username = Username;
                _Password = Password;
            }
            public String Username { get { return _Username; } }
            public String Password { get { return _Password; } }

            public override string ToString()
            {
                return _Username.Length + ";" + _Username + _Password.Length +";"+_Password;
            }

            public CredentialsInformation(String InstanceString)
            {
                String[] Arr1=InstanceString.Split(new char[] { ';' });

                int UsernameLength = int.Parse(Arr1[0]);
                _Username = Arr1[1].Substring(0, UsernameLength);

                String[] Arr2 = InstanceString.Substring(Arr1[0].Length + UsernameLength + 1).Split(new char[]{';'});

                int PasswordLength = int.Parse(Arr2[0]);
                _Password = Arr2[1].Substring(0, PasswordLength);
            }
            

        }

        private byte[] Entropy;
        public Credentials()
        {
            String Base64Entropy = ConfigurationSettings.AppSettings["Entropy"];
            Entropy = Convert.FromBase64String(Base64Entropy);
            CredentialsInformation s;
            
        }

        public void Store(CredentialsInformation Information)
        {
            throw new NotImplementedException();
                 //.Protect( data, s_aditionalEntropy, DataProtectionScope.CurrentUser )
        }

        public CredentialsInformation Load()
        {
            throw new NotImplementedException();
        }

        public Boolean CheckIfStored()
        {
            throw new NotImplementedException();
        }

    }
}
